#include <iostream>
#include <vector>

using namespace std;

class Solution {
public:
    int climbStairs(int n) {
        if (n < 0) return 0;
        if (n <= 1) return 1;
        vector<int> ways(n+1);
        ways[0] = ways[1] = 1;
        for (int i=2; i<=n; ++i) {  // faster than recursion
            ways[i] = ways[i-1] + ways[i-2];
        }
        return ways[n];
    }
};
